/**
 * @description 判断是某个按钮是有获得授权
 * @param elements 调用getUserPageAuth接口返回的权限数组
 * @param key 按钮的key，按钮是否需要授权可参考Authorization.vue页面的menu.pageElements值
 * @returns 有授权则返回true，没有权限则返回false
 * @author Elwin ZHANG
 * @date 2022-06-22 15:54
 */
export const hasElementAuth = (elements: any, key: string): boolean => {
  if (!elements || elements.length == 0) {
    return false
  }
  for (const element of elements) {
    if (element.elementKey == key) {
      return true
    }
  }
  return false
}
